Make C-u commit and restart hex input if we are already in a hex sequence.
authorMatthias Clasen <mclasen@redhat.com>
Wed, 7 Sep 2005 17:02:47 +0000 (17:02 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 7 Sep 2005 17:02:47 +0000 (17:02 +0000)
2005-09-07  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress):
Make C-u commit and restart hex input if we are already in a
hex sequence.

ChangeLog
ChangeLog.pre-2-10
gtk/gtkimcontextsimple.c

index edafbca20d374cd114c635a38361794e880d7604..5f5d55d34815ff73933fc461ba5d0ff275b85ba4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-09-07  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress): 
+       Make C-u commit and restart hex input if we are already in a
+       hex sequence.
+
 2005-09-06  Matthias Clasen  <mclasen@redhat.com>
 
        * gdk/x11/gdkkeys-x11.c (update_modmap): Make the modmap reflexive.
index edafbca20d374cd114c635a38361794e880d7604..5f5d55d34815ff73933fc461ba5d0ff275b85ba4 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-07  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress): 
+       Make C-u commit and restart hex input if we are already in a
+       hex sequence.
+
 2005-09-06  Matthias Clasen  <mclasen@redhat.com>
 
        * gdk/x11/gdkkeys-x11.c (update_modmap): Make the modmap reflexive.
index 8c6719e2242a0a0bef6fa22ac3a06259cb29f2f6..ac98ac06565283ca55f55643e7a5d3df98dbee57 100644 (file)
@@ -1381,7 +1381,8 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
   if (!have_hex_mods ||
       (n_compose > 0 && !context_simple->in_hex_sequence) || 
       (n_compose == 0 && !context_simple->in_hex_sequence && !is_hex_start) ||
-      (context_simple->in_hex_sequence && !hex_keyval && !is_space && !is_backspace))
+      (context_simple->in_hex_sequence && !hex_keyval && 
+       !is_hex_start && !is_space && !is_backspace))
     {
       if (event->state & (gtk_accelerator_get_default_mod_mask () & ~GDK_SHIFT_MASK))
        return FALSE;
@@ -1406,8 +1407,28 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
       return TRUE;
     }
 
+  if (context_simple->in_hex_sequence && have_hex_mods && is_hex_start)
+    {
+      if (context_simple->tentative_match &&
+         g_unichar_validate (context_simple->tentative_match))
+       {
+         gtk_im_context_simple_commit_char (context, context_simple->tentative_match);
+         context_simple->compose_buffer[0] = 0;
+       }
+      else 
+       {
+         /* invalid hex sequence */
+         if (n_compose > 0)
+           gdk_display_beep (gdk_drawable_get_display (event->window));
+         
+         context_simple->tentative_match = 0;
+         context_simple->in_hex_sequence = FALSE;
+         context_simple->compose_buffer[0] = 0;
+       }
+    }
+
   /* Check for hex sequence start */
-  if (n_compose == 0 && !context_simple->in_hex_sequence && have_hex_mods && is_hex_start)
+  if (!context_simple->in_hex_sequence && have_hex_mods && is_hex_start)
     {
       context_simple->compose_buffer[0] = 0;
       context_simple->in_hex_sequence = TRUE;